package com.xianniu.ltc.enums;

import lombok.Getter;

/**
 * @author wangruijie
 * @version 1.0
 * @description: < 客户级别 >
 * @date 2021/5/27 19:32
 */
@Getter
public enum AccountLevelEnum {
    ONE("019-01781062bc4b0004","大型客户"),
    TWO("019-01781062d04e0005", "中型客户"),
    THREE("019-01781062e72c0006", "小型客户");

    private String key;
    private String value;

    AccountLevelEnum(String key, String value){
        this.key=key;
        this.value=value;
    }
    /**
     * 自己定义一个静态方法,通过key返回枚举常量对象
     * @param key
     * @return
     */
    public static AccountLevelEnum getByKey(String key){

        for (AccountLevelEnum color: values()) {
            if(color.getKey().equals(key)){
                return  color;
            }
        }
        return null;
    }

    /**
     * 自己定义一个静态方法,通过value返回枚举常量对象
     * @param value
     * @return
     */
    public static AccountLevelEnum getByValue(String value){

        for (AccountLevelEnum color: values()) {
            if(color.getValue().equals(value)){
                return color;
            }
        }
        return null;
    }
}
